<div class="article">
<?php
$this->addScript(array(
	'/js/lib/bxslider/jquery.bxslider.js',
	'/js/viewArticle.js'
))->addCSSLink('/js/lib/bxslider/jquery.bxslider.css');

$a = $this->getData('article');
$g = $this->getData('gallery');
?>
	<h1><?=$a->getContent()->getTitle()?></h1>
	<div class="author"><![CDATA[ <?=$a->getAuthor()->getName()?> ]]></div>
	<?php
    if ($a->haveAlbum()) {
        $al =  $a->getAlbum();
        ?>
		<div class="bxslider">
			<?php for ($i=0,$l=$al->getPhotoCount();$i<$l;$i++) {
				$url = $al->getPhotoAt($i)->getImage($g['max_sz'])->source;
				$ttl = $al->getPhotoAt($i)->getCaption();
				?>
				<div title="<?=$ttl?>" style="width:<?=$g['x']?>px;height:<?=$g['y']?>px;float:left;background:url(<?=$url?>) no-repeat center"></div>
			<?php } ?>
		</div>
		<?php /*
		<ul id="bx-pager" class="thumbnails">
			<?php for ($i=0,$l=$al->getPhotoCount();$i<$l;$i++) {
				$url = $al->getPhotoAt($i)->getImage($g['max_icon_sz'])->source;
				$ttl = $al->getPhotoAt($i)->getCaption();
				?>
			<li class="thumbnail" >
				<a href="" data-slide-index="<?=$i?>" title="<?=$ttl?>">
				<div style="width:<?=$g['ix']?>px;height:<?=$g['iy']?>px;background:url(<?=$url?>) no-repeat center"></div>
				</a>
			</li>
			<?php } ?>
		</ul>
		*/ ?>
		
	<?php } ?>
	<div class="content"><![CDATA[ <?=$a->getContent()->getContent()?> ]]></div>
	
	<?php if ($a->cando($a::OP_WRITE, \App::getCurrentUser())) { ?>
		<widget class="Tools"
			edit="/article/edit/<?=$a->getId()?>"
			remove="/article/remove/<?=$a->getId()?>"
			/>
	<?php } ?>
</div>